# -*- coding: utf-8 -*-
"""
Module Description: 
Time : 2021/4/23 
Author : sxj
File : math_utils.py
"""
import decimal
from decimal import Decimal


def decimal_ceil(float_num, precision):
    """
    小数位向上取整
    保留1位小数: 3.21 --> 3.3
    :param float_num:
    :param precision: '0.00' --> 保留2位小数
    :return:
    """
    with decimal.localcontext() as tx:
        tx.rounding = decimal.ROUND_CEILING
        return float(Decimal(str(float_num)).quantize(Decimal(precision)))
